#!/usr/bin/python

import pygame

from game_of_life_unstable_backend import GameOfLife



class Frontend:
    def __init__(self):
        self.Gol = GameOfLife([(5, 5), (6, 5), (7, 5), (8, 5), (9, 5), (10, 5), (5, 6), (6, 6), (7, 6), (8, 6), (9, 6), (10, 6),
             (8, 12), (9, 12), (10, 12), (11, 12), (12, 12), (13, 12), (8, 13), (9, 13), (10, 13), (11, 13), (12, 13),
            (13, 13), (5, 8), (5, 9), (5, 10), (5, 11), (5, 12), (5, 13), (6, 8), (6, 9), (6,10), (6, 11), (6, 12),
             (6, 13), (12, 5), (12, 6), (12, 7), (12, 8), (12, 9), (12, 10),(13, 5), (13, 6), (13, 7), (13, 8), (13, 9), (13, 10) ])
        self.height = 450
        self.width  = 600
        self.center = (0,0)
        self.box = 10
        pygame.init()
        self.screen= pygame.display.set_mode((self.width,self.height), 0, 32)
        self.pixArray = pygame.PixelArray(self.screen)
        pygame.display.set_caption("Critter's Game of Life!")
        
    def draw_grid(self):
        topLeft = (self.center[0] + self.width/2, self.center[1] + self.height/2) # upper right corner of pygame surface
        bottomRight = (topLeft[0] + self.width, topLeft[1] + self.height)
        grid
        self.Gol.cells[(topLeft[0] / self.box, topLeft[1] / self.box)]
        
        for cell in self.Gol.cells:
            pygame.draw.circle(self.screen, (255,0,0), (self.center[0]+cell[0]*10, self.center[1]+cell[1]*10), 3)

        
Gui = Frontend()

while True:
    Gui.screen.fill((255,255,255))
    Gui.draw_grid()
    pygame.display.update()
    raw_input()
    Gui.Gol.step()



